package com.kongjian.manage.controller;

import com.kongjian.manage.model.vo.UserInfoVo;
import com.kongjian.manage.service.OauthUserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @author tangjunfeng
 * @Classname OauthLoginController.java
 * @Description 单点登录controller
 * @Date 2023-10-10
 * @Version V1.0
 */
@Api(tags = "单点登录")
@RestController
@RequestMapping("/user")
public class OauthLoginController {

    @Resource
    private OauthUserService userService;


    @GetMapping(value = "oauthlogin", produces = "text/html;charset=utf-8")
    @ApiOperation(value = "oauthlogin")
    public String oauthlogin(String code) {
        UserInfoVo user = userService.getUser(code);
        System.out.printf(ResponseEntity.ok(user).toString());
        return "数字孪生汉江流域";
    }


}
